//
//  NSString+KY.m
//  KYKJPackDemo
//
//  Created by Jordan zhou on 2017/10/12.
//  Copyright © 2017年 ???. All rights reserved.
//

#import "NSString+KY.h"

@implementation NSString (KY)

- (CGSize)sizeWithFont:(UIFont *)font maxSize:(CGSize)maxSize
{
    NSDictionary *attrs = @{NSFontAttributeName : font};
    
    return [self boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;
}

+ (NSString *)imageToBase64Str:(UIImage *)image
{
    NSData *data = UIImageJPEGRepresentation(image, 1.0f);
    NSString *imageStr = [data base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
    
    return imageStr;
}
@end
